package br.com.financas.business.impl;

import java.util.ArrayList;
import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.base.business.impl.ServiceImpl;
import br.com.base.exception.BaseException;
import br.com.base.model.UsuarioBase;
import br.com.financas.business.UserConnectionService;
import br.com.financas.exception.NegociosMaisControleException;
import br.com.financas.model.UserConnection;
import br.com.financas.repository.DAO.UserConnectionDAO;
import br.com.financas.repository.filter.FiltroUserConnection;

/**
 * 
 * @author Milton Domingues
 *
 */
@Service
public class UserConnectionServiceImpl extends ServiceImpl<UserConnection, Long, FiltroUserConnection, UserConnectionDAO> implements UserConnectionService {

	@Autowired
	private UserConnectionDAO usuarioDAO;

	public UserConnectionServiceImpl() {

	}

	@Override
	public UserConnectionDAO getRepositorioDAO() {
		return this.usuarioDAO;
	}

	@Override
	public void resolverPerDependencias(UserConnection vo, UsuarioBase usuario) {

	}

	@Override
	public void resolverPosDependencias(UserConnection vo, UsuarioBase usuario) {

	}

	@Override
	public void resolverPreExcluir(UserConnection vo) {

	}

	@Override
	public void tratarDadosEntidade(UserConnection vo) {

	}

	@Override
	public void validarAlteracao(UserConnection vo) {
		Collection<BaseException> erros = new ArrayList<BaseException>();
		this.validarEntidade(vo, erros);
		if (erros.size() > 0) {
			throw new NegociosMaisControleException(erros);
		}
	}

	private void validarEntidade(UserConnection vo, Collection<BaseException> erros) {

	}

	@Override
	public void validarExclusao(UserConnection vo) {

	}

	@Override
	public void validarInclusao(UserConnection vo) {
		Collection<BaseException> erros = new ArrayList<BaseException>();
		this.validarEntidade(vo, erros);
		if (erros.size() > 0) {
			throw new NegociosMaisControleException(erros);
		}
	}

	@Override
	public void validarUnicidade(UserConnection vo) {

	}
}
